#!/usr/bin/env python

import wx
import view
import resource.icon as icon

import __main as main

class Main(wx.Frame):
    '''Main object
    
    @author Julot <andy.julot@gmail.com>
    @since Saturday, January 14, 2012. 09:01 AM'''
    
    def __init__(self):
        super(Main, self).__init__(None, name='Main')
        import app
        meta = app.Meta()
        self.Title = '%s Version %s' % (meta.name, meta.long_version)
        self.Icon = icon.Main.Icon
        self._realize()
    
    def _realize(self):
        self.MenuBar = main.MenuBar()
        self.ToolBar = main.ToolBar(self)
        self.ToolBar.Realize()
        self.StatusBar = wx.StatusBar(self)
        
        panel = wx.Panel(self)
        self.options = main.Options(panel)
        self.splitter = wx.SplitterWindow(panel, style=wx.SP_LIVE_UPDATE)
        
        pl = wx.Panel(self.splitter)
        self.names = main.Names(pl)
        
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.names, 1, wx.GROW)
        pl.SetSizer(sizer)
        
        pr = wx.Panel(self.splitter)
        self.preview = main.Image(pr)
        
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.preview, 1, wx.GROW)
        pr.SetSizer(sizer)
        
        self.splitter.SetMinimumPaneSize(20)
        self.splitter.SplitVertically(pl, pr)
        
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.options, 0, wx.GROW)
        sizer.Add(self.splitter, 1, wx.GROW)
        panel.SetSizer(sizer)
        
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(panel, 1, wx.GROW)
        self.SetSizerAndFit(sizer)
    